//
//  PublicMacro.h
//  ZHYProject
//
//  Created by lc4y on 2017/12/13.
//  Copyright © 2017年 dtl. All rights reserved.
//
#import "TEALocalizableTool.h"

#ifndef PublicMacro_h
#define PublicMacro_h

#define ZHYScreenWidth [UIScreen mainScreen].bounds.size.width
#define ZHYScreenHeight [UIScreen mainScreen].bounds.size.height

#define NOTIFY_NET_CHANGE @"notifyNetChange"

typedef void (^WGCBaseActionBlock) (void);
typedef void (^WGCBaseObjectActionBlock) (id obj);

/** 多语言 */
#define MyNSLocalizedString(key) [[TEALocalizableTool shareInstance] localizedStringForKey: (key)]


#define WS(weakSelf) __weak __typeof(&*self)weakSelf = self
#define SS(strongSelf)  __strong __typeof(&*weakSelf)strongSelf = weakSelf
/** 提示框 */
#define AlertDismiss          [SVProgressHUD dismiss];
#define AlertError(msg)       [SVProgressHUD showErrorWithStatus:MyNSLocalizedString(msg)]
#define AlertSuccess(msg)     [SVProgressHUD showSuccessWithStatus:MyNSLocalizedString(msg)];
#define AlertStatus(msg)      [SVProgressHUD showWithStatus:MyNSLocalizedString(msg)];
#define AlertStatusWithOutMsg [SVProgressHUD showWithStatus:nil];
#define AlertStatusBlack(msg) [SVProgressHUD showWithStatus:MyNSLocalizedString(msg) maskType:SVProgressHUDMaskTypeBlack];
#define AlertStatusClear(msg) [SVProgressHUD showWithStatus:MyNSLocalizedString(msg) maskType:SVProgressHUDMaskTypeClear];

#define px1920Height(px)     (((px)/1920.0f) * ZHYScreenHeight)
#define px1080Width(px)     (((px)/1080.0f) * ZHYScreenWidth)
#define colorWithAlpha(r, g, b, a) [UIColor colorWithRed:(r) / 255.0 green:(g) / 255.0 blue:(b) / 255.0 alpha:(a)]
#define rgba(r, g, b, a) [UIColor colorWithRed:(r) / 255.0 green:(g) / 255.0 blue:(b) / 255.0 alpha:(a)]
#define imageWithName(image) [UIImage imageNamed:image]
#define fontWithSize(size) [UIFont systemFontOfSize:size]

// 保存缓存
#define ZHYCache_Object(object,key) [[ZHYCacheManager cacheMananger] saveData:object forKey:key]
// 获取对应的值
#define ZHYFetch_Object(key) [[ZHYCacheManager cacheMananger] fetchDataForKey:key]
// 删除缓存
#define ZHYRemove_Object(key) [[ZHYCacheManager cacheMananger] removeDataForKey:key]
// 清空缓存
#define ZHYClear_Object [[ZHYCacheManager cacheMananger] clearAllData]

#define SAVE_OBJECT(object,key) {[[NSUserDefaults standardUserDefaults] setObject:object forKey:key] ; [[NSUserDefaults standardUserDefaults]synchronize];}
#define SAVE_BOOL(value,key) {[[NSUserDefaults standardUserDefaults] setBool:value forKey:key] ; [[NSUserDefaults standardUserDefaults]synchronize];}
#define EXRACT_OBJECT(key)        [[NSUserDefaults standardUserDefaults] objectForKey:key]
#define EXRACT_BOOL(key) [[NSUserDefaults standardUserDefaults]boolForKey:key]
#define REMOVE_OBJECT(key)   [[NSUserDefaults standardUserDefaults]removeObjectForKey:key]


/** 大标题的高度 */
#define kBaseTitleLabelHeight 90


#define LOGIN @"LOGIN"
#define USERNAME @"USERNAME"
#define TRUENAME @"TRUENAME"
#define PHONE @"PHONE"
#define INFODIC @"INFODIC"
#define UID @"UID"
#define TOKEN @"TOKEN"
#define MAC   [UIDevice currentDevice].identifierForVendor.UUIDString
#define VERSION @"1.0"          //版本


// 改变整个程序的背景色
#define ZHYChangeAllBGNotification @"ZHYChangeAllBGNotification"
// 改变整个程序的背景色
#define ZHYChangeHomeLayoutNotification @"ZHYChangeHomeLayoutNotification"

#endif /* PublicMacro_h */
